home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / mint / mint104s.zoo / mint.src / makefile.lcc < prev    next >
Makefile  |  1993-03-08  |  7KB  |  224 lines

  1. #
  2. # Makefile for MiNT using the LCC
  3. #
  4.  
  5. # if you're cross-compiling, define NATIVECC
  6. # to the host's C compiler, NATIVECFLAGS to
  7. # the appropriate flags for it, and NATIVELIBS
  8. # to appropriate libraries
  9. # NATIVECC = cc -DNO_STDLIB
  10. # NATIVECFLAGS = -g
  11. # NATIVELIBS =
  12.  
  13. NATIVECC = lcc
  14. NATIVECFLAGS = -O
  15. NATIVELIBS =
  16.  
  17. #
  18. # depending on your version of bison/yacc, you may
  19. # need to change these names, e.g. to
  20. # YACC = yacc
  21. # YTABC = y.tab.c
  22. # YTABH = y.tab.h
  23.  
  24. YACC = bison -d
  25. YTABC = asm_tab.c
  26. YTABH = asm_tab.h
  27.  
  28. # here are defs for the cross compiler
  29. # MiNT must be compiled with 16 bit integers
  30.  
  31. CC = lcc
  32. AS = asm
  33. MODEL = -w -b0 -r0 -bn -aw
  34. MODEL030 = $(MODEL) -m3
  35. LIBS =
  36.  
  37. # add -DMULTITOS for a MultiTOS kernel
  38. # add -DONLY030 for a version of MiNT that needs a 680x0, x>=3
  39.  
  40. DEFS =
  41. DEFS030 = -DONLY030
  42.  
  43. SYMS = -Hmint.sym
  44.  
  45. # 30    - pointers do not point to same type of object
  46. # 86    - formal definitions conflict with type list
  47. # 100    - no prototype declared for function
  48. # 104    - conversion from pointer to const/volatile to pointer to non-const/volatile
  49. # 135    - assignment to shorter data type (precision may be lost)
  50. # 154    - no prototype declared for function pointer
  51. # 159    - use of unary minus on unsigned value
  52. ERRORS = -j30e86e100e104e135i154e159i
  53.  
  54. OPTS = -d1 -Oloop -v -cfsb -cag
  55. ASOPTS = -ma -m8 -d -.
  56. COPTS = $(OPTS) $(MODEL) $(ERRORS) $(DEFS)
  57. CFLAGS = $(COPTS) $(SYMS)
  58. ASFLAGS = $(ASOPTS) $(DEFS)
  59. CFLAGS030 = $(OPTS) $(MODEL030) $(ERRORS) $(DEFS030)
  60. ASFLAGS030 = -m3 $(ASOPTS) $(DEFS030)
  61.  
  62. LDFLAGS = -t=
  63.  
  64. COBJS = main.o bios.o xbios.o console.o dos.o dosdir.o dosfile.o dosmem.o \
  65.     dossig.o filesys.o mem.o proc.o signal.o timeout.o tty.o util.o \
  66.     biosfs.o pipefs.o procfs.o tosfs.o debug.o rendez.o \
  67.     unifs.o shmfs.o fasttext.o welcome.o nalloc2.o memprot.o0 realloc.o
  68.  
  69. COBJS030 = main.o0 bios.o0 xbios.o0 console.o0 dos.o0 dosdir.o0 dosfile.o0 dosmem.o0 \
  70.     dossig.o0 filesys.o0 mem.o0 proc.o0 signal.o0 timeout.o0 tty.o0 util.o0 \
  71.     biosfs.o0 pipefs.o0 procfs.o0 tosfs.o0 debug.o0 rendez.o0 \
  72.     unifs.o0 shmfs.o0 fasttext.o0 welcome.o0 nalloc2.o0 memprot.o0 realloc.o0
  73.  
  74. CSRCS = main.c bios.c xbios.c console.c dos.c dosdir.c dosfile.c dosmem.c \
  75.     dossig.c filesys.c mem.c proc.c signal.c timeout.c tty.c util.c \
  76.     biosfs.c pipefs.c procfs.c tosfs.c debug.c rendez.c \
  77.     unifs.c shmfs.c fasttext.c welcome.c nalloc2.c memprot.c realloc.c
  78.  
  79. SOBJS = context.o intr.o syscall.o quickzer.o quickmov.o cpu.o
  80. SOBJS030 = context.o0 intr.o0 syscall.o0 quickzer.o0 quickmov.o0 cpu.o0
  81.  
  82. OBJS = $(COBJS) $(SOBJS)
  83. OBJS030 = $(COBJS030) $(SOBJS030)
  84.  
  85. all: mint.prg mint030.prg
  86.  
  87. mint.prg: $(OBJS)
  88.     $(CC) $(CFLAGS) -o mint.prg $(LDFLAGS) $(OBJS) $(LIBS)
  89.  
  90. mint030.prg: $(OBJS030)
  91.     $(CC) $(CFLAGS030) -o mint030.prg $(LDFLAGS) $(OBJS030) $(LIBS)
  92.  
  93. $(SOBJS) $(SOBJS030): proc.h
  94. $(COBJS) $(COBJS030): mint.sym
  95.  
  96. main.o: version.h
  97. welcome.o: version.h
  98. bios.o: inline.h
  99.  
  100. mint.sym: mint.h ctype.h assert.h atarierr.h basepage.h types.h \
  101.     signal.h mem.h proc.h file.h sproto.h proto.h inline.h
  102.     $(CC) $(COPTS) -ph -o mint.sym mint.h
  103.  
  104. #
  105. # assembler source files are now handled in a radically different
  106. # fashion. We build a pre-processor program, asmtrans, that
  107. # takes the .spp files, merges them with an include file that
  108. # gives various offsets into structures of interest, and produces
  109. # the .s files as output. This has two major advantages:
  110. # (1) it lets us use the same source for both the Lattice and
  111. #     gcc assembler files (the translator will convert), and
  112. # (2) if we change the CONTEXT or PROC structures, we don't
  113. #     have to dig through the source code looking for
  114. #     magic numbers
  115.  
  116. # the asm translator program
  117. # Note that this must be compiled with the native CC of whatever
  118. # system you're using; see the definitions at the top of this
  119. # file.
  120.  
  121. ATRANSOBJ = asmtab.o trutil.o trans.o
  122. ATRANS = asmtrans.ttp
  123.  
  124. $(ATRANS): $(ATRANSOBJ)
  125.     $(NATIVECC) $(NATIVECFLAGS) -o $(ATRANS) $(ATRANSOBJ) \
  126.         $(NATIVELIBS)
  127.  
  128. asmtab.o: asmtab.c asmtrans.h
  129.     $(NATIVECC) $(NATIVECFLAGS) -o $@ -c asmtab.c
  130.  
  131. trutil.o: trutil.c asmtrans.h
  132.     $(NATIVECC) $(NATIVECFLAGS) -o $@ -c trutil.c
  133.  
  134. trans.o: trans.c asmtrans.h
  135.     $(NATIVECC) $(NATIVECFLAGS) -o $@ -c trans.c
  136.  
  137.  
  138. asmtab.c asmtab.h:    asm.y
  139.     $(YACC) asm.y
  140.     mv $(YTABC) asmtab.c
  141.     mv $(YTABH) asmtab.h
  142.  
  143. # the magic number include file is generated automagically
  144. # NOTE that of course, magic.i can only reliably be generated
  145. # on an Atari ST; if you're cross-compiling, you'll have
  146. # to edit magic.i by hand
  147. # for cross compilers; uncomment the following definitions
  148. # and comment out the other ones below
  149.  
  150. # for cross-compiling
  151.  
  152. # GENMAGICPRG=echo
  153. # magic.i: proc.h file.h genmagic.c
  154. #    echo "Warning: magic.i may be out of date"
  155.  
  156. #for native compiling
  157.  
  158. GENMAGICPRG=genmagic.ttp
  159.  
  160. $(GENMAGICPRG): genmagic.c proc.h file.h
  161.     $(CC) $(CFLAGS) -DGENMAGIC -o $(GENMAGICPRG) genmagic.c
  162.  
  163. magic.i: $(GENMAGICPRG)
  164.     $(GENMAGICPRG) $@
  165.  
  166. #
  167. # assembler source files
  168. #
  169. .SUFFIXES: .spp .o0
  170.  
  171. .spp.o:
  172.     $(ATRANS) $(DEFS) -asm -o $*.s $<
  173.     $(AS) $(ASFLAGS) -o$@ $*.s
  174.     $(RM) $*.s
  175. .spp.o0:
  176.     $(ATRANS) $(DEFS030) -asm -o $*.s $<
  177.     $(AS) $(ASFLAGS030) -o__asm.o $*.s
  178.     mv __asm.o $@
  179.     $(RM) $*.s
  180. .spp.s:
  181.     $(ATRANS) $(DEFS) -asm -o $@ $<
  182. .c.o0:
  183.     $(CC) -c $(CFLAGS030) -o$@ $<
  184.  
  185. context.o: context.spp magic.i $(ATRANS)
  186. intr.o: intr.spp magic.i $(ATRANS)
  187. syscall.o: syscall.spp magic.i $(ATRANS)
  188. quickzer.o: quickzer.spp $(ATRANS)
  189. quickmov.o: quickmov.spp $(ATRANS)
  190. cpu.o: cpu.spp $(ATRANS)
  191.  
  192. context.o0: context.spp magic.i $(ATRANS)
  193. intr.o0: intr.spp magic.i $(ATRANS)
  194. syscall.o0: syscall.spp magic.i $(ATRANS)
  195. quickzer.o0: quickzer.spp $(ATRANS)
  196. quickmov.o0: quickmov.spp $(ATRANS)
  197. cpu.o0: cpu.spp $(ATRANS)
  198.  
  199. #
  200. # mkptypes generates prototypes from C source code. If you don't have it,
  201. # you'll have to add/delete function prototypes by hand.
  202. # also: Sozobon users will have to edit proto.h by hand to change the
  203. #    #if defined(__STDC__) || defined(__cplusplus)
  204. # line into
  205. #    #if __STDC__
  206. #
  207. # This is more trouble than its worth, lets forget it for know (lets be
  208. # honest editting proto.h by hand is usually easier...)
  209. #
  210. #proto.h: $(CSRCS)
  211. #    mkptypes $(CSRCS) >proto.h
  212.  
  213. #
  214. # macros for cleaning up
  215. #
  216. GENFILES= $(OBJS) $(OBJS030) $(ATRANSOBJ) $(ATRANS) $(GENMAGICPRG) $(YTABC) $(YTABH) magic.i __asm.o
  217. EXTRAS= asmtab.c asmtab.h mint.prg mint030.prg mint.sym
  218.  
  219. clean:
  220.     $(RM) -f $(GENFILES)
  221.  
  222. realclean:
  223.     $(RM) -f $(GENFILES) $(EXTRAS)
  224.